package com.qingmi.farmer.viewmodel;

import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.databinding.ObservableList;

import com.qingmi.farmer.data.model.News;
import com.wjjun.basemvpvm.viewmodel.BaseViewModel;

/**
 * 新闻
 * Created by 67535 on 2018/5/1.
 */
public class NewsItemViewModel extends BaseViewModel {

    public String id;

    public final ObservableField<String> title = new ObservableField<>();

    public final ObservableField<String> desc = new ObservableField<>();

    public final ObservableList<String> imgs = new ObservableArrayList<>();

    public final ObservableField<Long> time = new ObservableField<>();

    public String url;

    public NewsItemViewModel(News news) {
        id = news.getNewsId();
        title.set(news.getTitle());
        desc.set(news.getSummary());
        imgs.addAll(news.getPics());
        time.set(news.getReleaseAt());
        url = news.getUrl();
    }


}
